﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Astronergy.MES.App.Library.Logger
{
    public class LogMsg
    {
        public LogMsg(string text, string category)
        {
            Category = category;
            DateTime = DateTime.Now;
            Text = text;
            Type = EunmMsgType.Unknown;
        }

        public LogMsg(string text, EunmMsgType type)
        {
            Category = "";
            DateTime = DateTime.Now;
            Text = text;
            Type = type;
        }

        public LogMsg(DateTime dt, string text, EunmMsgType type)
        {
            Category = "";
            DateTime = dt;
            Text = text;
            Type = type;
        }

        public string Text { get; set; }

        public DateTime DateTime { get; set; }

        public string Category { get; set; }

        public EunmMsgType Type { get; set; }

        public override string ToString()
        {
            var bulider = new StringBuilder();
            bulider.Append(DateTime.ToString("yyyy-MM-dd HH:mm:ss:ff"));
            bulider.Append(Category);
            bulider.Append(" ");
            bulider.Append(Text);
            return bulider.ToString();
        }
    }
}
